<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>区域规则管理</title>
</head>
<body>
<div ng-app="myApp" ng-controller="PieceCtrl">
        <ui-form key="pieceAdd" column="2">
            <ui-form-select-remote
                    url="system/supplier/listall"
                    label="供货商:"
                    name="supplierCode"
                    value-name="code"
                    text-name="name"></ui-form-select-remote>
            <ui-form-select name="direction" label="运单配送类型">
                <option value="">请选择配送类型</option>
                <option value="0">配送</option>
                <option value="1">上门换</option>
                <option value="2">上门退</option>
            </ui-form-select>
            <ui-form-select name="settlementType" label="合作商类型:">
                <option value="">请选择价格类型</option>
                <option value="0">自营</option>
                <option value="1">合作站</option>
                <option value="1">合作商</option>
                <option value="1">大型合作商</option>
            </ui-form-select>
            <ui-form-select name="temperature" label="运输温度等级">
                <option value="">请选择运输温度等级</option>
                <option value="0">常温</option>
                <option value="1">生鲜冷链</option>
            </ui-form-select>
            <ui-form-select name="packageSize" label="包裹大小规格">
                <option value="">请选择包裹大小规格</option>
                <option value="1">小件</option>
                <option value="2">大件</option>
            </ui-form-select>
            <ui-form-select name="signer" label="签收方式">
                <option value="">请选择签收方式</option>
                <option value="0">代签</option>
                <option value="1">本人签收</option>
            </ui-form-select>
            <ui-form-select name="expressScheduleType" label="配送时效要求:">
                <option value="">请选择配送时效要求</option>
                <option value="0">未知</option>
                <option value="1">当日达</option>
                <option value="2">次晨达</option>
                <option value="3">三日达</option>
                <option value="4">工作日</option>
                <option value="5">节假日</option>
                <option value="6">夜间配</option>
                <option value="7">上午达</option>
                <option value="8">下午达</option>
            </ui-form-select>
            <ui-form-select name="cod" label="是否含待收款:">
                <option value="">请选择是否含待收款</option>
                <option value="0">否</option>
                <option value="1">是</option>
            </ui-form-select>
            <ui-form-input name="firstPrice" label="首件单价:"></ui-form-input>
            <ui-form-input name="secondPrice" label="拖件单价:"></ui-form-input>
            <ui-form-region label="地区" p-name="province" c-name="city" a-name="county"></ui-form-region>
        </ui-form>
</div>
<script>
    angular.module('myApp', ['ui.form']);
    angular.module('myApp').controller('PieceCtrl', function ($scope) {
        $scope.$on('ui.form.submit',function (event,param) {
            $.ajax({
                url:"rule/piece/add",
                type:"post",
                data:param
            }).done(function (result) {
                if(result.code=='0000'){
                    toastr.success("新增成功");
                    if(opener && opener.reloadTable){
                        opener.reloadTable({});
                    }
                    setTimeout(function () {
                        window.close();
                    },1500);
                }else{
                    toastr.error(result.msg);
                }
            }).fail(function (err) {
                
            });
        })
    });
</script>
</body>
</html>
